package com.sto.common.designMode.factory;

/**
 * 运算类工厂
 *
 * @author ChenPeng
 * @since 2022-07-23 23:43
 */
public class OperationFactory {

    public static AbstractOperation createOperation(String operationType) {
        AbstractOperation abstractOperation = null;
        switch (operationType) {
            case "+":
                abstractOperation = new OperationAdd();
                break;
            case "-":
                abstractOperation = new OperationSub();
                break;
            case "*":
                abstractOperation = new OperationMul();
                break;
            case "/":
                abstractOperation = new OperationDiv();
                break;
        }
        return abstractOperation;
    }
}
